package com.Web;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.Dao.EmployeeDao;
import com.entity.Employee;


public class savaAccess extends HttpServlet {


	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		HttpSession session = request.getSession();
		String name = request.getParameter("zhuang");
		EmployeeDao dao = new EmployeeDao();
		Employee e = (Employee) session.getAttribute("em");
		
			if("supper".equals(name)){
				e.setSupper(true);
				
			}else if("employee".equals(name)){
				e.setSupper(false);
			}
			dao.edit(e);
			session.setAttribute("e", e);
			request.getRequestDispatcher("/WEB-INF/views/login.jsp").forward(request, response);

		
	}

}
